package com.bjpowernode.vo;

public class PageVo {
    //当前页第几页
    private Integer pageNo = 1;

    //每页大小
    private Integer pageSize = 9;

    //总记录数
    private Integer totalRecord = 0;
    //总页数
    private Integer totalPages =0;

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getTotalRecord() {
        return totalRecord;
    }

    public void setTotalRecord(Integer totalRecord) {
        this.totalRecord = totalRecord;
    }

    public Integer getTotalPages() {
        //计算总页数
        if (totalRecord % pageSize == 0) {
            totalPages = totalRecord / pageSize;
            //pageSize在Controller中已经判断并处理过了，不会出现为0的情况
        } else {
            totalPages = totalRecord / pageSize + 1;
        }
        return totalPages;
    }


    public void setTotalPages(Integer totalPages) {
        this.totalPages = totalPages;
    }

    @Override
    public String toString() {
        return "PageVo{" +
                "pageNo=" + pageNo +
                ", pageSize=" + pageSize +
                ", totalRecord=" + totalRecord +
                ", totalPages=" + totalPages +
                '}';
    }
}
